/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package impss;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Mikehood
 */
@Entity
@Table(name = "buy")
@NamedQueries({@NamedQuery(name = "Buy.findAll", query = "SELECT b FROM Buy b"), @NamedQuery(name = "Buy.findByBuyID", query = "SELECT b FROM Buy b WHERE b.buyID = :buyID"), @NamedQuery(name = "Buy.findByBuyNumber", query = "SELECT b FROM Buy b WHERE b.buyNumber = :buyNumber"), @NamedQuery(name = "Buy.findByBuyState", query = "SELECT b FROM Buy b WHERE b.buyState = :buyState")})
public class Buy implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "buyID")
    private Integer buyID;
    @Column(name = "buyNumber")
    private Integer buyNumber;
    @Column(name = "buyState")
    private Short buyState;
    @JoinColumn(name = "phoneID", referencedColumnName = "phoneID")
    @ManyToOne
    private Integer phoneID;
    @JoinColumn(name = "customerID", referencedColumnName = "customerID")
    @ManyToOne
    private Integer customerID;
    @JoinColumn(name = "expressID", referencedColumnName = "expressID")
    @ManyToOne
    private Integer expressID;

    public Buy() {
    }

    public Buy(Integer buyID) {
        this.buyID = buyID;
    }

    public Integer getBuyID() {
        return buyID;
    }

    public void setBuyID(Integer buyID) {
        this.buyID = buyID;
    }

    public Integer getBuyNumber() {
        return buyNumber;
    }

    public void setBuyNumber(Integer buyNumber) {
        this.buyNumber = buyNumber;
    }

    public Short getBuyState() {
        return buyState;
    }

    public void setBuyState(Short buyState) {
        this.buyState = buyState;
    }

    public Integer getPhoneID() {
        return phoneID;
    }

    public void setPhoneID(Integer phoneID) {
        this.phoneID = phoneID;
    }

    public Integer getCustomerID() {
        return customerID;
    }

    public void setCustomerID(Integer customerID) {
        this.customerID = customerID;
    }

    public Integer getExpressID() {
        return expressID;
    }

    public void setExpressID(Integer expressID) {
        this.expressID = expressID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (buyID != null ? buyID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Buy)) {
            return false;
        }
        Buy other = (Buy) object;
        if ((this.buyID == null && other.buyID != null) || (this.buyID != null && !this.buyID.equals(other.buyID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "impss.Buy[buyID=" + buyID + "]";
    }

}
